package com.utils;


import org.apache.commons.beanutils.BeanUtils;

import java.util.Map;

public class WebUtils {


    public static <T> T copyParamToBean(Map value, T bean) {
        try {
            //获取所有的请求参数，把Map中的值注入到Javabean中
            BeanUtils.populate(bean, value);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bean;
    }

    public static int parseInt(String strInt, int defaultValue) {
        try {
            return Integer.parseInt(strInt, defaultValue);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return defaultValue;
    }
}
